Page({
  goLogin() {
    const info = wx.getStorageSync('user')
    if (!info.nickName) {
      wx.navigateTo({
        url: '/pages/login/index',
      })
    }

  },
  onShow() {
    this.getUserInfo()
  },
  // 获取用户信息
  async getUserInfo() {
    try {
      const data = wx.getStorageSync('user')
      // 保存数据
      this.setData({
        userInfo: {
          avatar: data.avatar,
          nickName: data.nickName,
        },
      })
    } catch (error) {
      console.log(error.message)
    }
  },
})